package com.gitee.wsl.struct.grammar.parser


/** A convenience function to use for referencing a parser that is not initialized up to this moment. */
fun <T> parser(block: () -> Parser<T>): Parser<T> = ParserReference(block)

 class ParserReference<out T> internal constructor(parserProvider: () -> Parser<T>) : Parser<T> {
     val parser: Parser<T> by lazy(parserProvider)

    override suspend fun ParsingScope.parse(): T =parser()
}